//package src;

import java.awt.*;
import java.awt.geom.*;
import java.io.*;

public class ShapeLine extends Shape{	
	

  	private int x1, y1, x2, y2;
		
	
  	private Line2D.Double line;
  

	public ShapeLine(int x1, int y1, int x2, int y2, Color color)
  	{
  		super(color);				
    	this.x1 = x1;
    	this.y1 = y1;
    	this.x2 = x2;
    	this.y2 = y2;
  	}

  	public void draw(Graphics g)
  	{
  		Graphics2D g2d = (Graphics2D) g;								
    	line = new Line2D.Double(x1, y1, x2, y2); 
    	g2d.setColor(getColor());										
		g2d.draw(line);			
  	}

	public int setLeftPoint(int x)	
	{
		int deltaX;
		deltaX = x - x1;
		x2 += deltaX;
		
		return x1 = x;
	}
	
	public int setTopPoint(int y)	
	{
		int deltaY;
		deltaY = y - y1;
		y2 += deltaY;
		
		return y1 = y;
	}
	

}